package orm.infrastructure.interfaces;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * User: Awake
 * Date: 01.05.12
 * Time: 18:26
 * To change this template use File | Settings | File Templates.
 */
public interface IBinarySerialize {

    /**
     * Serialize object into binary stream
     * @param outputStream  result of binary serialization
     * @throws UnsupportedOperationException if object is not valid
     */

    public void writeTo(DataOutputStream outputStream) throws IOException;

    /**
     * Recover object from binary stream
     * @param inputStream  input binary stream
     * @throws UnsupportedOperationException if object is null
     */

    public void readFrom(DataInputStream inputStream) throws IOException;

}
